Skip to content

feat: MCP bridge + settings UI — unified capability types (Phase 1+2) - #471

Merged
Blankll merged 8 commits into
masterfrom
feat/unified-capability-types
Aug 2, 2026
Merged

feat: MCP bridge + settings UI — unified capability types (Phase 1+2)#471
Blankll merged 8 commits into
masterfrom
feat/unified-capability-types

Conversation

@Blankll

@Blankll Blankll commented Jul 30, 2026

Copy link
Copy Markdown
Member

Summary

Phase 1 + Phase 2 of the unified Data Studio MCP architecture: migrate capability types to data-studio-agent, add an axum-based HTTP bridge, and ship the MCP Bridge settings UI.

Phase 1 — Unified capability types

  • Delete duplicate types.rs + registry.rs from dockit, imports now from data_studio_agent::capabilities
  • SourceKind::DocKit -> AppLocal
  • No duplicated capability definitions across repos

Phase 2 — HTTP bridge (mcp_bridge.rs)

  • axum server on port 9120 (configurable), auto-fallback to random port if busy
  • POST /tools — lists Safe capabilities as OpenAI-compatible tool definitions + connections
  • POST /invoke — executes a capability with connection resolution + SSH tunnel support; rejects Elevated/Destructive (403)
  • GET /health — app version + actual port
  • Port file (mcp-port) for zero-config discovery by the MCP server
  • Config at {app_data_dir}/mcp-config.json (separate from .store.dat)
  • McpServerHandle Tauri managed state with graceful shutdown/restart
  • Tauri commands: get_mcp_status, save_mcp_config

MCP Bridge settings UI

  • New MCP Bridge settings tab (mcp-bridge.vue)
  • Green/red status indicator with port number
  • Port input (1024-65535, optional auto), restart button, auto-start toggle
  • i18n: enUS + zhCN

Fixes included

  • Port-file deletion race on restart — await JoinHandle instead of heuristic sleep
  • Risk level filtering at bridge level
  • Write port file before spawning server task (no orphaned server)
  • Stale port file liveness check in status

Verification

  • cargo check — clean
  • npx tsc --noEmit — clean
  • npm run lint:check — clean

Part of geek-fun/data-studio-agent#9 (Phase 1, Phase 2, MCP UI). Companion PR: geek-fun/sqlkit#127.

- Remove duplicate capabilities/types.rs and capabilities/registry.rs
- Import RiskLevel, SourceKind, CapabilityHandler, Capability, CapabilityRegistry
  from data-studio-agent instead
- Replace SourceKind::DocKit with SourceKind::AppLocal
- Update init_registry() call to pass registration function array
- Update agent/executor.rs and agent_adapters.rs to use data-studio-agent paths
@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 53.94046% with 263 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.92%. Comparing base (2e46d63) to head (cdaeb92).

Files with missing lines Patch % Lines
src-tauri/src/mcp_bridge.rs 54.63% 230 Missing ⚠️
src-tauri/src/lib.rs 0.00% 32 Missing ⚠️
src-tauri/src/agent_adapters.rs 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #471      +/-   ##
==========================================
- Coverage   52.37%   51.92%   -0.45%     
==========================================
  Files         115      114       -1     
  Lines       14548    14928     +380     
  Branches      865      865              
==========================================
+ Hits         7619     7752     +133     
- Misses       6670     6917     +247     
  Partials      259      259              
Files with missing lines Coverage Δ
src-tauri/src/agent/executor.rs 0.00% <ø> (ø)
src-tauri/src/capabilities/commands.rs 89.09% <100.00%> (+1.25%) ⬆️
src-tauri/src/capabilities/dockit.rs 90.38% <100.00%> (ø)
src-tauri/src/capabilities/dynamo.rs 94.14% <ø> (ø)
src-tauri/src/capabilities/es.rs 97.53% <ø> (ø)
src-tauri/src/capabilities/mongo.rs 83.77% <ø> (ø)
src/lang/enUS.ts 100.00% <ø> (ø)
src/lang/zhCN.ts 100.00% <ø> (ø)
src-tauri/src/agent_adapters.rs 0.00% <0.00%> (ø)
src-tauri/src/lib.rs 0.00% <0.00%> (ø)
... and 1 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Blankll and others added 4 commits July 31, 2026 01:05
Introduces an embedded HTTP bridge (axum) that exposes the capability
system over HTTP for the external data-studio-mcp TypeScript server.

Endpoints:
  POST /tools   — list all agent-tagged capabilities
  POST /invoke  — execute a capability by name with connection resolution
  GET  /health  — health check

Port auto-fallback via portpicker. Config and port file stored in
app_data_dir.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Integrates the MCP bridge into the app lifecycle:
- Initialize McpServerHandle as managed Tauri state
- Read mcp-config.json and auto-start bridge in setup hook
- Register get_mcp_status and save_mcp_config Tauri commands

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
New settings tab in the Settings dialog with:
- Status indicator (running/stopped with port number)
- Port input with restart button
- Auto-start toggle switch

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
English and Simplified Chinese translations for the new MCP Bridge
settings section.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@Blankll Blankll changed the title Phase 1: Unify capability types with data-studio-agent Phase 1+2: Unify capability types + HTTP MCP bridge Jul 30, 2026
Blankll and others added 2 commits July 31, 2026 01:14
- Security: reject Elevated/Destructive capabilities on bridge (403)
- Lifecycle: save_mcp_config now stops server when autoStart=false
- Stale port file: liveness-test (TCP connect) before reporting running
- Write port file BEFORE spawning server to avoid orphaned task
- app_version: use real version from package_info()
- McpConfig::load: log warning on corrupt/parse error
- TOCTOU: remove port_available check, bind directly with fallback

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@Blankll Blankll changed the title Phase 1+2: Unify capability types + HTTP MCP bridge feat: MCP bridge + settings UI — unified capability types (Phase 1+2) Aug 2, 2026
@Blankll
Blankll merged commit da7590d into master Aug 2, 2026
9 checks passed
@Blankll
Blankll deleted the feat/unified-capability-types branch August 2, 2026 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant